<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/1/23
  Time: 11:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
ssssa
<video id="video" width="100%" height="100%"></video>
<script>
    var video = document.getElementById("video");
    try {
        window.URL = window.URL || window.webkitURL || window.msURL	|| window.oURL;
        // Normalizes navigator.getUserMedia
        alert("a");
        navigator.getUserMedia = navigator.getUserMedia	|| navigator.webkitGetUserMedia
                || navigator.mozGetUserMedia || navigator.msGetUserMedia;

        // Tries it with spec syntax
        navigator.getUserMedia({
            video : true
        }, successsCallback, errorCallback);
    } catch (err) {
        alert("b");
        // Tries it with old spec of string syntax
        navigator.getUserMedia('video', successsCallback, errorCallback);
    }


    function successsCallback(stream){
        if (window.URL) {
            video.src = window.URL.createObjectURL(stream);
        } else {
            video.src = stream;
        }
        video.autoplay = true;
    }
    function errorCallback(error){
        console.log(error);
        alert("error");
    }
</script>
</body>
</html>
